import random
from PIL import Image, ImageDraw, ImageFont
image=Image.new(mode="RGB",size=(200,40),color=(200,220,210))
draw_brush=ImageDraw.Draw(image,mode="RGB")
charset_font=ImageFont.truetype('arial.ttf',28)
for i in range(7):
    character=random.choice([chr(random.randint(65,90)),str(random.randint(0,9))])
    character_color=(random.randint(0,255),random.randint(0,255),random.randint(0,255))
    draw_brush.text([i*30,0],character,character_color,font=charset_font)
with open("test.png","wb") as f:
    image.save(f,format="png")